package com.zjbd.douyanglive.controller;

import com.zjbd.douyanglive.service.ILiveService;
import com.zjbd.douyangcommoncore.result.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 直播接口
 */
@Tag(name = "直播模块")
@Slf4j
@RestController
//自动刷新配置
@RefreshScope
@RequestMapping("/douyang/live")
public class LiveController {

    @Autowired
    private ILiveService iLiveService;

    //:是默认值的意思 非必填
    @Value("${live.is-open:true}")
    private boolean isOpen;

    @Operation(summary = "获取直播间列表")
    @GetMapping("/getLiveList")
    public Result getLiveList(){
        if(isOpen){
            return Result.success("这是直播间列表");
        }
        return Result.error("直播系统已经关闭");
    }

    @GetMapping("/LiveTip")
    public String LiveTip(){
        log.info("1、接口收到请求");
        String s = iLiveService.liveTip(121);
        return "打赏女主播";
    }

}
